package String;

import java.util.Scanner;

public class User {
    public static void main(String[] args) {
        for (int i = 0; i < 3; i++) {
            String username = "jay";
            String password = "123456";
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入用户名:");
            String name = scanner.nextLine();
            System.out.println("请输入密码：");
            String pwd = scanner.nextLine();
            if (name.equals(username) && pwd.equals(password)) {
                System.out.println("登录成功" + username);
                break;
            } else {
                System.out.println("用户名或密码错误");
            }if(!name.equals(username) && pwd.equals(password)){
                if (2 - i == 0) {
                    System.out.println("你的登录次数已经用完，如有问题请与管理员联系！");
                } else {
                    System.out.println("你今天还有" + (2 - i) + "次登录的机会！");
                }
            }
        }
    }
}


